package com.vitas.coin.data.bean;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;


@Entity
@Keep
public final class ChildrenVoiceBean implements Parcelable {
    @PrimaryKey(
            autoGenerate = true
    )
    private final int id;
    @Nullable
    private String parentName;
    @Nullable
    private final String name;
    @Nullable
    private final String voiceUrl;
    @Nullable
    private final String coverUrl;
    private final long timeLength;
    @Nullable
    private final String avatarUrl;
    private boolean isPlaying;
    private boolean isCollect;

    public ChildrenVoiceBean(int id, @Nullable String parentName, @Nullable String name, @Nullable String voiceUrl, @Nullable String coverUrl, long timeLength, @Nullable String avatarUrl, boolean isPlaying, boolean isCollect) {
        this.id = id;
        this.parentName = parentName;
        this.name = name;
        this.voiceUrl = voiceUrl;
        this.coverUrl = coverUrl;
        this.timeLength = timeLength;
        this.avatarUrl = avatarUrl;
        this.isPlaying = isPlaying;
        this.isCollect = isCollect;
    }

    @Ignore
    public ChildrenVoiceBean(int id, @Nullable String name, @Nullable String voiceUrl, boolean isCollect) {
        this.id = id;
        this.name = name;
        this.voiceUrl = voiceUrl;
        this.isCollect = isCollect;
        coverUrl = null;
        timeLength = 0;
        avatarUrl = null;
    }

    @Ignore
    public ChildrenVoiceBean(String name, String path) {
        this.name = name;
        voiceUrl = path;
        coverUrl = null;
        timeLength = 0;
        avatarUrl = null;
        id = 0;
    }

    protected ChildrenVoiceBean(Parcel in) {
        id = in.readInt();
        parentName = in.readString();
        name = in.readString();
        voiceUrl = in.readString();
        coverUrl = in.readString();
        timeLength = in.readLong();
        avatarUrl = in.readString();
        isPlaying = in.readByte() != 0;
        isCollect = in.readByte() != 0;
    }

    public static final Creator<ChildrenVoiceBean> CREATOR = new Creator<ChildrenVoiceBean>() {
        @Override
        public ChildrenVoiceBean createFromParcel(Parcel in) {
            return new ChildrenVoiceBean(in);
        }

        @Override
        public ChildrenVoiceBean[] newArray(int size) {
            return new ChildrenVoiceBean[size];
        }
    };

    public final int getId() {
        return this.id;
    }

    @Nullable
    public final String getParentName() {
        return this.parentName;
    }

    public final void setParentName(@Nullable String var1) {
        this.parentName = var1;
    }

    @Nullable
    public final String getName() {
        return this.name;
    }

    @Nullable
    public final String getVoiceUrl() {
        return this.voiceUrl;
    }

    @Nullable
    public final String getCoverUrl() {
        return this.coverUrl;
    }

    public final long getTimeLength() {
        return this.timeLength;
    }

    @Nullable
    public final String getAvatarUrl() {
        return this.avatarUrl;
    }

    public final boolean isPlaying() {
        return this.isPlaying;
    }

    public final void setPlaying(boolean var1) {
        this.isPlaying = var1;
    }

    public final boolean isCollect() {
        return this.isCollect;
    }

    public final void setCollect(boolean var1) {
        this.isCollect = var1;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(parentName);
        dest.writeString(name);
        dest.writeString(voiceUrl);
        dest.writeString(coverUrl);
        dest.writeLong(timeLength);
        dest.writeString(avatarUrl);
        dest.writeByte((byte) (isPlaying ? 1 : 0));
        dest.writeByte((byte) (isCollect ? 1 : 0));
    }
}
